package GUI;

import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JFrame;
import javax.swing.JPanel;

public class Maps extends JPanel {
    
    private int height, width;
    private String[] list;

    public Maps(JFrame window) {
        
        width = window.getWidth();
        height = window.getHeight();
        //======================================================================
        setSize(width, height);
        //populate map list=====================================================
        list = new String[5];
        list[0] = "Snake";
        list[1] = "Placeholder";
        list[2] = "Placeholder";
        list[3] = "Placeholder";
        list[4] = "Placeholder";
        //======================================================================
        setVisible(true);

    }

    public String[] getMapList() {
        return list;
    }

    public void createMap(int map) {
        
        switch (map) {
            case 0:
                System.out.println("placeholder");
                break;
        }
    }

    //Overrides=================================================================
    @Override
    protected void paintComponent(Graphics g) {
        int pWidth = width/8;
        int pLength = height/3;
        //background============================================================
        g.setColor(new Color(150,255,50));
        g.fillRect(0, 0, width, height);
        //draw path=============================================================
        g.setColor(Color.lightGray);
        g.fillRect(0, height/2, pLength, pWidth);
        g.fillRect(width/4, height/2-pWidth, pWidth, pLength);
        g.fillRect(width/4, height/6, pLength, pWidth);
        g.fillRect(width/2, height/6, pLength, pWidth);
        g.fillRect(width/2+pWidth, height/2-pWidth, pWidth, pLength);
        g.fillRect(width-pLength, height/2, pLength-pLength/4, pWidth);
        g.setColor(Color.red); //testing only
        g.fillRect(width-pLength/4, height/2, pLength/4, pWidth);
    }
}